//
// Created by ancho on 2021/11/6.
//
#include <iostream>

using namespace std;
int calc(int k, int base){
    int a[5],i,sum=0;
    for(i=0;k;k/=base,i++){
        a[i]=k % base;
        sum += a[i];
    }
    return sum;
}
int main1(){
    for (int i = 2991;i<10000;i++){
        if (calc(i, 12) == calc(i, 10) && calc(i, 12) == calc(i, 16)) {
            printf("%d\n",i);
        }
    }
    return 0;
}

